home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / f90 / malloc.z / malloc
Encoding:
Text File  |  2002-10-03  |  3.4 KB  |  77 lines

  1. MALLOC(3I)                                            Last changed: 4-13-99
  2.  
  3.  
  4. NNAAMMEE
  5.      MMAALLLLOOCC, FFRREEEE - Allocates and deallocates main memory
  6.  
  7. SSYYNNOOPPSSIISS
  8.      MMAALLLLOOCC (([NN==]_n_b_y_t_e_s))
  9.  
  10.      CCAALLLL FFRREEEE (([PP==]_i_p_t_r))
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      UNICOS, UNICOS/mk, IRIX systems
  14.  
  15.      CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
  16.  
  17. SSTTAANNDDAARRDDSS
  18.      Fortran extension
  19.  
  20. DDEESSCCRRIIPPTTIIOONN
  21.      MMAALLLLOOCC and FFRREEEE provide a simple general-purpose memory allocation
  22.      package.  MMAALLLLOOCC returns a pointer to a block of at least _n_b_y_t_e_s bytes
  23.      suitably aligned for any use.  MMAALLLLOOCC returns the first contiguous
  24.      region of free space found in a circular search from the last block
  25.      allocated or freed, coalescing adjacent free blocks as it searches.
  26.      It calls ssbbrrkk(2) to get more memory from the system when there is no
  27.      suitable space already free.
  28.  
  29.      FFRREEEE is a pointer to a block previously allocated by MMAALLLLOOCC.  After
  30.      FFRREEEE is performed, this space is made available for further
  31.      allocation, but its contents are left undisturbed.
  32.  
  33.      As intrinsics, these are elemental functions.  They accept the
  34.      following arguments:
  35.  
  36.      _n_b_y_t_e_s    The amount to be allocated.
  37.  
  38.      _i_p_t_r      A pointer to the block of memory to be freed.
  39.  
  40. RREETTUURRNN VVAALLUUEESS
  41.      Undefined results occur if the space assigned by MMAALLLLOOCC is overrun or
  42.      if some random number is handed to FFRREEEE.
  43.  
  44.      MMAALLLLOOCC returns a NULL pointer if there is no available memory or if
  45.      the area has been detectably corrupted by storing outside the bounds
  46.      of a block.  When this happens the block pointed to by _i_p_t_r can be
  47.      destroyed.
  48.  
  49. NNOOTTEESS
  50.      For most MIPSpro 7 Fortran 90 and CF90 applications, MMAALLLLOOCC and FFRREEEE
  51.      can be replaced by the AALLLLOOOOCCAATTEE and DDEEAALLLLOOCCAATTEE Fortran statements.
  52.      The statements are simpler and portable.
  53.  
  54.      Search time increases when many objects have been allocated; that is,
  55.      if a program allocates but never frees, then each successive
  56.      allocation takes longer.
  57.  
  58.      IRIX systems can be configured with virtual swap space.  This allows
  59.      processes to allocate more virtual memory than is actually available,
  60.      allowing the use of sparse addressing, successful forks and subsequent
  61.      eexxeecc(2)s by programs larger than 1/2 the available virtual memory, and
  62.      so forth.  Thus programs using MMAALLLLOOCC can get a successful return.
  63.      Later, however the system may generate a SIGKILL signal if virtual
  64.      memory was overcommitted and processes attempt to actually use all of
  65.      the overcommitted memory.  If the system has no virtual swap space
  66.      configured, then processes are limited to using no more virtual memory
  67.      than the sum of physical memory and swap space.  See the sswwaapp(1M) man
  68.      page for more information.
  69.  
  70. SSEEEE AALLSSOO
  71.      sswwaapp(1M)
  72.  
  73.      eexxeecc(2), ssbbrrkk(2)
  74.  
  75.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed version of this
  76.      man page.
  77.